CC = gcc
CFLAGS = -g -Wall -pthread -I.
LDFLAGS= -Llib -Wl,-rpath,lib
LIBS =

SRCS = multipart_parser.c
TEST_SRCS = examples/web.c
ALL_SRCS = $(SRCS) $(TEST_SRCS)

OBJS = $(SRCS:.c=.o)
ALL_OBJS = $(ALL_SRCS:.c=.o)

TEST_EXEC = $(TEST_SRCS:.c=)

all: $(TEST_EXEC)

$(TEST_EXEC): $(ALL_OBJS)
	$(CC) $(OBJS) $@.o -o $@ $(CFLAGS) $(LDFLAGS) $(LIBS)

lib: $(OBJS)
	ar crs libmultipart.a $(OBJS)

%o: %c
	$(CC) $(CFLAGS) -c -o $@ $<

clean: 
	rm -f *~ $(ALL_OBJS) libmultipart.a

